-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix yaml upon empty volumeMounts or volumes #855
base: main
Are you sure you want to change the base?
Conversation
Today it create illegal yaml with undefined volumeMounts and volumes yielding these messages from kubeval: WARN - stdin contains an invalid Pod (vault.helm-vault-server-test) - spec.containers.0.volumeMounts: Invalid type. Expected: array, given: null WARN - stdin contains an invalid Pod (vault.helm-vault-server-test) - spec.volumes: Invalid type. Expected: array, given: null Instead; insert empty lists.
templates/tests/server-test.yaml
Outdated
@@ -46,10 +46,14 @@ spec: | |||
volumeMounts: | |||
{{- if .Values.server.volumeMounts }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also move the if statement one line up, to make it include the key, in example:
{{- if .Values.server.volumeMounts }}
volumeMounts:
{{- toYaml .Values.server.volumeMounts | nindent 8}}
{{- end }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it now (better late than never)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @arve0's suggestion makes sense, and it would also be good to add a test to test/unit/server-test.bats
to check that the rendering for empty volumes is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think the only thing missing here is a test in test/unit/server-test.bats
to verify that volumeMounts
and volumes
are not rendered when server.volumeMounts
and server.volumes
are not set.
Added some tests.... a long time after |
Today it create illegal yaml with undefined volumeMounts and volumes yielding these messages from kubeval: WARN - stdin contains an invalid Pod (vault.helm-vault-server-test) - spec.containers.0.volumeMounts: Invalid type. Expected: array, given: null WARN - stdin contains an invalid Pod (vault.helm-vault-server-test) - spec.volumes: Invalid type. Expected: array, given: null
Instead; insert empty lists.